import numpy as np
import matplotlib.pyplot as plt

# 生成频率数据
x = np.linspace(0.5, 2.5, 1000)

# 生成纯合格大豆油的吸收系数数据
y1 = 0.1 + 0.4 * (x - 0.5) + 0.2 * np.exp(-(x - 1)**2 / 0.2)  # 平滑递增，1.0 THz附近宽缓隆起

# 生成模拟地沟油的吸收系数数据
y2 = y1 + 0.3 * (1 - np.exp(-(x - 0.5)**2 / 0.6)) + 0.4 * np.exp(-(x - 1.2)**2 / 0.2)  # 基线整体偏高，低频区增强，1.2 THz宽峰

# 生成模拟地沟油+50ppm辣椒素的吸收系数数据
y3 = y2 + 0.2 * np.exp(-(x - 1.42)**2 / 0.1) + 0.2 * np.exp(-(x - 1.67)**2 / 0.1) + 0.08 * (1 - np.exp(-(x - 1)**2 / 0.6))  # 新增特征峰，0.8-1.2 Thz略有增强

# 绘图
plt.figure(figsize=(10, 6))
plt.plot(x, y1, 'k-', label="Pure Qualified Soybean Oil (Substrate Oil)")
plt.plot(x, y2, 'r--', label="Simulated gutter oil (Frying oil)")
plt.plot(x, y3, 'b-', label="Simulating gutter oil + 50 ppm Capsaicin")
plt.xlabel('Frequency (THz)')
plt.ylabel('Absorption coefficient α(ν) (cm⁻¹)')
plt.legend()
plt.show()